package com.bwie.parkdemo.mvvm.model;

import android.content.Context;

import com.bwie.lib_core.base.BaseEntity;
import com.bwie.lib_core.mvvm.base.BaseModel;
import com.bwie.lib_core.network.HttpRetrofitFactory;
import com.bwie.lib_core.network.HttpType;
import com.bwie.parkdemo.dao.LoginUserServe;
import com.bwie.parkdemo.mvvm.model.entity.LoginEntity;
import com.bwie.parkdemo.mvvm.model.entity.SelAllApplyEntity;
import com.bwie.parkdemo.mvvm.model.entity.SelVisitorValuesEntity;

import io.reactivex.Observable;
import okhttp3.RequestBody;

/**
 * 全部申请model
 * */
public class SelAllApplyModel extends BaseModel {

    //请求全部申请接口列表
    @Override
    public Observable<BaseEntity> request(RequestBody... bodyes) {
        Observable<SelAllApplyEntity>source = HttpRetrofitFactory
                .getInstance().factory(HttpType.INTERFACE).getRetrofit()
                .create(Api.class).requestSelAllApply(bodyes[0]);
        return changeOB(source);
    }

    //获取访客申请详情
    public Observable<BaseEntity>requestVistorValues(RequestBody body){
        Observable<SelVisitorValuesEntity>source = HttpRetrofitFactory.getInstance()
                .factory(HttpType.INTERFACE).getRetrofit().create(Api.class)
                .requestSelVistorValue(body);
        return changeOB(source);
    }
    //获取用户id
    public LoginEntity.Values requestUser(Context ctx){
        return new LoginUserServe(ctx).selUser();
    }
    @Override
    public void cleared() {

    }
}
